{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Numpy 简介"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 导入numpy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Numpy**是**Python**的一个很重要的第三方库，很多其他科学计算的第三方库都是以**Numpy**为基础建立的。\n",
    "\n",
    "**Numpy**的一个重要特性是它的数组计算。\n",
    "\n",
    "在使用**Numpy**之前，我们需要导入`numpy`包："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from numpy import *"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "使用前一定要先导入 Numpy 包，导入的方法有以下几种：\n",
    "\n",
    "```python    \n",
    "    import numpy\n",
    "    import numpy as np\n",
    "    from numpy import *\n",
    "    from numpy import array, sin\n",
    "```\n",
    "\n",
    "事实上，在**ipython**中可以使用magic命令来快速导入**Numpy**的内容。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Using matplotlib backend: Qt4Agg\n",
      "Populating the interactive namespace from numpy and matplotlib\n"
     ]
    }
   ],
   "source": [
    "%pylab"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数组上的数学操作"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "假如我们想将列表中的每个元素增加`1`，但列表不支持这样的操作（报错）："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "can only concatenate list (not \"int\") to list",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-3-068856d2a224>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[0ma\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m2\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m3\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m4\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0ma\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m: can only concatenate list (not \"int\") to list"
     ]
    }
   ],
   "source": [
    "a = [1, 2, 3, 4]\n",
    "a + 1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "转成 `array` ："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 2, 3, 4])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = array(a)\n",
    "a"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`array` 数组支持每个元素加 `1` 这样的操作："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([2, 3, 4, 5])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a + 1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "与另一个 `array` 相加，得到对应元素相加的结果："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([3, 5, 7, 9])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b = array([2, 3, 4, 5])\n",
    "a + b"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对应元素相乘："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 2,  6, 12, 20])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a * b"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对应元素乘方："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([   1,    8,   81, 1024])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a ** b"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 提取数组中的元素"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "提取第一个元素："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "提取前两个元素："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 2])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[:2]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "最后两个元素："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([3, 4])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[-2:]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "将它们相加："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([4, 6])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[:2] + a[-2:]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 修改数组形状"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "查看 `array` 的形状："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(4L,)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "修改 `array` 的形状："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 2],\n",
       "       [3, 4]])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.shape = 2,2\n",
    "a"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 多维数组"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`a` 现在变成了一个二维的数组，可以进行加法："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[2, 4],\n",
       "       [6, 8]])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a + a"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "乘法仍然是对应元素的乘积，并不是按照矩阵乘法来计算："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1,  4],\n",
       "       [ 9, 16]])"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a * a"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 画图"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "linspace 用来生成一组等间隔的数据："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.   ,  0.314,  0.628,  0.942,  1.257,  1.571,  1.885,  2.199,\n",
       "        2.513,  2.827,  3.142,  3.456,  3.77 ,  4.084,  4.398,  4.712,\n",
       "        5.027,  5.341,  5.655,  5.969,  6.283])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = linspace(0, 2*pi, 21)\n",
    "%precision 3\n",
    "a"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "三角函数："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([  0.000e+00,   3.090e-01,   5.878e-01,   8.090e-01,   9.511e-01,\n",
       "         1.000e+00,   9.511e-01,   8.090e-01,   5.878e-01,   3.090e-01,\n",
       "         1.225e-16,  -3.090e-01,  -5.878e-01,  -8.090e-01,  -9.511e-01,\n",
       "        -1.000e+00,  -9.511e-01,  -8.090e-01,  -5.878e-01,  -3.090e-01,\n",
       "        -2.449e-16])"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b = sin(a)\n",
    "b"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "画出图像："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0xa128ba8>]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAEACAYAAAC9Gb03AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XnczXX+//HHy9KIqVS/byRaqUmaSUomgyuUJWkxQ4u0\nj1JSJq2m1FTybVrQEFMm2rRQpJpQLmMphcpeWSr6xZQJQynL+/vH+5iMrutyznWW9+dzzvN+u123\nazvXOU9cXud13p/3Ys45REQkf1UIHUBERLJLhV5EJM+p0IuI5DkVehGRPKdCLyKS51ToRUTyXNqF\n3sxGmNkaM5tfxm0GmdknZvahmTVM9zFFRCR5mejo/wa0Le2bZtYeqOucqwf8HhiagccUEZEkpV3o\nnXPTgG/KuElHYGTitrOA6mZWI93HFRGR5ORijP4gYOVOn68CaufgcUVEhNxdjLVdPte+CyIiOVIp\nB4/xBVBnp89rJ772X8xMxV9EpBycc7s20/8lFx39eKAbgJk1AdY559aUdEPnXGzf7rjjjozcz9at\njkmTHN26OapXd7Rr53jmGcemTT+97cqVjgEDHA0aOA45xHHbbY4lS8Jlj/vfvfIrfxzfkpGJ6ZXP\nAjOBo8xspZldambdzax7oni/Biw3s6XAMKBHuo+Zj+bPhxtvhEMOgZtugoYNYckSeO01OO88qFr1\npz9Tu7b/mXnz4OWX4bvvoKgIGjeGwYPhq69y/scQk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XwXb3kiJlVBsYATznnXg6dp7wSL7tfBU4InSVJJwMdE2PczwItzWxU4Ewpc859mXj/FfASfjg2\nDlYBq5xz7yU+fxFf+OOmHTAn8fdfqtCF/j8LqhLPTF2A8YEzFQwzM+BxYJFz7uHQeVJlZv/PzKon\nPt4TOBWI0AmqpXPO3eqcq+OcOwz/0vst51y30LlSYWZVzWyvxMfVgNPwu9pGnnNuNbDSzI5MfKk1\nsDBgpPI6D98olCnoFkXOua1mtmNBVUXg8ZjN+HgWaAHsn1g8drtz7m+BY6WiKdAVmGdmOwrkLc65\nvwfMlIoDgZGJWQcVgCedc28GzlRecRzGrAG85PsFKgFPO+cmho2Ukp7A04kmcxlwSeA8KUk8ubYG\ndnttRAumRETyXOihGxERyTIVehGRPKdCLyKS51ToRUTynAq9iEieU6EXEclzKvQiInlOhV5EJM/9\nHzC+mVy4trE1AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xa0daf98>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "plot(a, b)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 从数组中选择元素"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "假设我们想选取数组b中所有非负的部分，首先可以利用 `b` 产生一组布尔值："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ True,  True,  True,  True,  True,  True,  True,  True,  True,\n",
       "        True,  True, False, False, False, False, False, False, False,\n",
       "       False, False, False], dtype=bool)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b >= 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "mask = b >= 0"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "画出所有对应的非负值对应的点："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0xa177be0>]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEACAYAAABI5zaHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAELJJREFUeJzt3X+M5Hddx/Hnm912V4JYSZOi1yNNlqrtH0D9cVTRMgbu\nuvQSmhgjniKJmHDR3O79Z+Wu2jXxNE3QkF2S2mBBIglnAoScncLdiQxLEArVthR7bXprmty12ohA\ng8Jubq9v/9hh3ZvOzq+d3Zn57PORTO7743Pfec/nO/Paz35mvjuRmUiSyvKKQRcgSeo/w12SCmS4\nS1KBDHdJKpDhLkkFMtwlqUBtwz0iPhIRL0TEEy3azEfEMxHxeETc0t8SJUnd6mTk/lFgerOdEXEH\n8PrMvBF4H3Bfn2qTJPWobbhn5peA77Ro8k7gY/W2DwPXRMR1/SlPktSLfsy57wEubFi/CFzfh+NK\nknrUrzdUo2Hdv2kgSQM03odjPAfs3bB+fX3bFSLCwJekHmRm4wC6rX6M3E8B7wGIiFuB72bmC80a\nZubI3u65556B17Bb62+s/fiBAyS87Hb37bcPvNbS+t76B3/rVScfhfwE8M/AT0fEhYh4b0QcjojD\n9cB+CPj3iDgP3A/8Qc/VSB04MDvL8ampK7Ydm5pi/8zMgCqShk/baZnMPNRBmyP9KUdq77aDBwH4\n44UFxpaXuTw5yfTMzPp2Sf2Zc98VKpXKoEvYklGuv1nttx08ODJhPsp9D9Y/qmIrczpd3VFE7tR9\nSVIpIoIc0BuqkqQhY7hLUoGcc9eWLFarnJmfZ3xlhdWJCQ7Mzo7MXHgvdtvj1egy3NWzxWqV00eP\ncmJpaX3b8fpyiYG32x6vRp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Q/7Ofg\nlfV/x4GvAr88Kv3fYf1d9X+/R+59vehpADqpH17+0c+hkJlfAr7TosnQ9n0HtcOQ9jtAZv5nZj5W\nX/4f4Bzwkw3Nhrn/O6kfhvscfL++eDVrA7VvNzQZ2v6HjuqHLvq/3+He7IKmPR20ub7PdfSqk/oT\n+KX6r3UPRcTNO1bd1g1z37czMv1e/3TZLcDDDbtGov9b1D/U5yAiXhERj7F2AeUXMvPJhiZD3f8d\n1N9V/7f7KGS3+n7R0w7rpI5/BfZm5vcj4h3AZ4Cf2t6y+mpY+76dkej3iHgV8EngaH0E/LImDetD\n1f9t6h/qc5CZLwFviogfA05HRCUzaw3Nhrb/O6i/q/7v98j9OWDvhvW9rP10bNXm+vq2YdC2/sz8\n3g9/fcrMzwJXRcRrdq7ELRnmvm9pFPo9Iq4CPgV8PDM/06TJUPd/u/pH4RwAZOaLQBX4+YZdQ93/\nP7RZ/d32f7/Dff2ip4i4mrWLnk41tDkFvAfWr4BtetHTgLStPyKui4ioL+9j7eOkzebGhtEw931L\nw97v9doeAJ7MzA9u0mxo+7+T+of5HETEtRFxTX35R4D9wKMNzYa5/9vW323/93VaJkf8oqdO6gd+\nHfj9iFgFvg/85sAKbhARnwDeClwbEReAe1j71M/Q93272hnifq97C/Bu4BsR8cMX5THgdTD8/U8H\n9TPc5+AngI9FxCtYG7T+XWZ+flSyhw7qp8v+9yImSSqQX7MnSQUy3CWpQIa7JBXIcJekAhnuklQg\nw12SCmS4S1KBDHdJKtD/AUtnPQ2WTKLjAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xa109828>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot(a[mask], b[mask], 'ro')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
